# -*- coding: utf-8 -*-
from __future__ import unicode_literals

__author__ = 'zhengkc'

from django.db import models


class Projects(models.Model):
    """项目"""
    project_name = models.CharField(verbose_name=u'项目名称', max_length=200)

    class Meta:
        verbose_name = u'项目'
        verbose_name_plural = u'项目'

    def __unicode__(self):
        return u'%s' % (self.project_name)


class Template(models.Model):
    """模板"""
    template_name = models.CharField(verbose_name=u'模板', max_length=200)

    class Meta:
        verbose_name = u'模板'
        verbose_name_plural = u'模板'

    def __unicode__(self):
        return u'%s' % (self.template_name)


class ItemCategory(models.Model):
    """事项类别"""
    item_category_name = models.CharField(verbose_name=u'事项类别', max_length=100)

    class Meta:
        verbose_name = u'事项类别'
        verbose_name_plural = u'事项类别'

    def __unicode__(self):
        return u'%s' % (self.item_category_name)


class Item(models.Model):
    """具体事项"""
    item_category = models.ForeignKey(ItemCategory, verbose_name=u'事项类别', max_length=200)
    template = models.ForeignKey(Template, verbose_name=u'模板', max_length=200)
    project = models.ForeignKey(Projects, verbose_name=u'项目', max_length=200)
    item_name = models.CharField(verbose_name=u'事项名称', max_length=200)
    inspect = models.BooleanField(verbose_name=u'检查与否', default=False)
    item_plan = models.CharField(verbose_name=u'事项进度', max_length=200, help_text='事项进度百分比')
    item_executor = models.CharField(verbose_name=u'事项执行人', max_length=20)
    remark = models.CharField(verbose_name=u'备注', max_length=100)

    class Meta:
        verbose_name = u'具体事项'
        verbose_name_plural = u'具体事项'

    def __unicode__(self):
        return u'%s' % (self.item_name)

    def __str__(self):
        return u'%s' % (self.item_name)
